<?php

$str =str_replace(array(" ","__"),"_",str_replace(array("  ",";"),array(" "),strtolower("This is   test; with small   AND BIG letter")));
echo $str;

?>